import os

import numpy as np
import cv2

img_path = r'./data/train/imgs'
img_names = os.listdir(img_path)
img_names.sort()
cnt = len(img_names)
imgs = []
for file in img_names:
    img = cv2.imread(os.path.join(img_path, file)).astype(np.float32)/255
    img = cv2.resize(img, (1250,500))
    imgs.append(img)
img_stack = np.stack(imgs, axis = 0)
print(img_stack.shape)
mean_B = np.mean(img_stack[:,:,:,0])
mean_G = np.mean(img_stack[:,:,:,1])
mean_R = np.mean(img_stack[:,:,:,2])
std_B = np.std(img_stack[:,:,:,0])
std_G = np.std(img_stack[:,:,:,1])
std_R = np.std(img_stack[:,:,:,2])
print(f'mean B: {mean_B}')
print(f'mean G: {mean_G}')
print(f'mean R: {mean_R}')
print(f'std B: {std_B}')
print(f'std G: {std_G}')
print(f'std R: {std_R}')